package org.donghuan.rms.framework.domain;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class Archive implements PropertyChangeListener {

	private Long id;
	private String archiveName;
	private String iSBN;
	private String category;
	private String location;
	private String compulsoryMeasure;
	private Person founder;
	private Person suspecter;
	private Person agenter;
	private Date createDate;
	private Date incidentDate;
	private List<RecordFile> recordfiles;
	private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
			this);

	public Archive() {
	}

	public Archive(String archiveName, String iSBN, Person founder,
			Date createDate) {
		super();
		this.archiveName = archiveName;
		this.iSBN = iSBN;
		this.founder = founder;
		this.createDate = createDate;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		propertyChangeSupport.firePropertyChange("category", this.category,
				this.category = category);
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		propertyChangeSupport.firePropertyChange("location", this.location,
				this.location = location);
	}

	public String getCompulsoryMeasure() {
		return compulsoryMeasure;
	}

	public void setCompulsoryMeasure(String compulsoryMeasure) {
		propertyChangeSupport.firePropertyChange("compulsoryMeasure",
				this.compulsoryMeasure,
				this.compulsoryMeasure = compulsoryMeasure);
	}

	public Person getAgenter() {
		return agenter;
	}

	public void setAgenter(Person agenter) {
		propertyChangeSupport.firePropertyChange("person", this.agenter,
				this.agenter = agenter);
	}

	public Person getSuspecter() {
		return suspecter;
	}

	public void setSuspecter(Person suspecter) {
		propertyChangeSupport.firePropertyChange("suspecter", this.suspecter,
				this.suspecter);
	}

	public Date getIncidentDate() {
		return incidentDate;
	}

	public void setIncidentDate(Date incidentDate) {
		propertyChangeSupport.firePropertyChange("incidentDate",
				this.incidentDate, this.incidentDate = incidentDate);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		propertyChangeSupport.firePropertyChange("id", this.id, this.id = id);
	}

	public String getArchiveName() {
		return archiveName;
	}

	public void setArchiveName(String archiveName) {
		propertyChangeSupport.firePropertyChange("archiveName",
				this.archiveName, this.archiveName = archiveName);
	}

	public String getISBN() {
		return iSBN;
	}

	public void setISBN(String isbn) {
		propertyChangeSupport
				.firePropertyChange("iSBN", iSBN, this.iSBN = isbn);
	}

	public Person getFounder() {
		return founder;
	}

	public void setFounder(Person founder) {
		propertyChangeSupport.firePropertyChange("founder", this.founder,
				this.founder = founder);
	}

	public List<RecordFile> getRecordfiles() {
		return recordfiles;
	}

	public void setRecordfiles(List<RecordFile> recordfiles) {
		propertyChangeSupport.firePropertyChange("recordFiles",
				this.recordfiles, this.recordfiles = recordfiles);
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		propertyChangeSupport.firePropertyChange("createDate", this.createDate,
				this.createDate = createDate);
	}

	public Archive(String name) {
		this.archiveName = name;
	}

	@Override
	public String toString() {
		return "Archive [id=" + id + ", archiveName=" + archiveName + ", ISBN="
				+ iSBN + ", destination=" + location + ", founder=" + founder
				+ ", suspecter=" + suspecter + ", argenter=" + agenter
				+ ", createDate=" + createDate + ", incidentDate="
				+ incidentDate + ", recordfiles=" + recordfiles + "]";
	}

	public void addPropertyChangedListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
	};

	public void removePropertyChangedListener(PropertyChangeListener listener) {
		propertyChangeSupport.removePropertyChangeListener(listener);

	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
	}

}
